package com.heima.media.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.media.dto.WmMaterialDto;
import com.heima.media.service.IWmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/v1/material")
public class WmMaterialController {

    @Autowired
    private IWmMaterialService wmMaterialService;

    //图片上传
    @PostMapping("/upload_picture")
    public ResponseResult upload(MultipartFile file) {
        return wmMaterialService.upload(file);
    }

    //图片列表查询
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto){
        return wmMaterialService.findList(dto);
    }
}